﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
using System.Data;
using System.Data.SqlClient;

namespace Quản_Lý_Thư_Viện
{
    class LoaitheDataAccess
    {
        private DataProvider _provider = new DataProvider();
		
		public LoaitheDataAccess()
		{
			_provider.connect();
		}

        public ArrayList getDSloaithe()
		{
			string query = "SELECT * FROM LOAITHE";
            SqlDataReader reader = (SqlDataReader)_provider.executeQuery(query);
            
            ArrayList arr = new ArrayList();
            LoaitheInfo     loaithe;
            while (reader.Read())
            {
                loaithe = new LoaitheInfo();
                loaithe.Maloaithe = reader["MALOAITHE"].ToString();
                loaithe.Tenloaithe = reader["TENLOAITHE"].ToString();
                arr.Add(loaithe);
            }

            reader.Close();
            return arr;
		}
    }
}
